/*
 * @Author: wuyuxin
 * @Date: 2022-05-31 22:53:15
 * @LastEditors: wuyuxin
 * @LastEditTime: 2022-05-31 22:53:29
 * @Description:
 */
function* foo(num) {
  const test = "111";
  console.log("函数开始执行~");

  const value1 = 100 * num;
  console.log("第一段代码:", value1, test);
  const n = yield value1;

  const value2 = 200 * n;
  console.log("第二段代码:", value2, test);
  const count = yield value2;

  const value3 = 300 * count;
  console.log("第三段代码:", value3, test);
  yield value3;

  console.log("函数执行结束~", test);
  return "123";
}

const generator = foo(10);

console.log(generator.next());
console.log(generator.next());
console.log(generator.next());
console.log(generator.next());
